#include <iostream>
#include "Cash.h"

using namespace std;
using namespace Homework;

namespace Homework
{
Cash::Cash()
{
	payment = 0;
	payment2 = 0;
}

Cash::~Cash()
{
}

bool Cash::Check(int amount)
{
	cout << "Please insert amount" << endl;
	cin >> payment2;

	payment = payment + payment2;

	if(food[(Homework::PType)(amount-1)].price == payment)
	{
		return true;
	}
	else if(payment > food[(Homework::PType)(amount-1)].price)
	{
		cout << "Your change is " << (payment-food[(Homework::PType)(amount-1)].price) << endl;
		return true;
	}
	else
	{
		return false;
	}
}

double Cash::getPayment(int amount)
{
	return food[(Homework::PType)(amount-1)].price - payment;
}
}